package Demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 34255
 * Date: 2024-07-06
 * Time: 18:50
 */
public class myArray1 {
//    private Object[] array = new Object[10];

//    public void setVal(int pos,T val){
//        this.array[pos] = val;
//    }
//
//    public T getVal(int pos){
//        return (T)this.array[pos];
//    }

    public static <T extends Comparable<T>> T findMax(T array[]){
        T max = array[0];
        for (int i = 1; i < array.length; i++) {
            if(max.compareTo(array[i]) < 0){
                max = array[i];
            }
        }
        return max;
    }

    public static void main(String[] args) {
        Integer[] array = new Integer[]{1,2,3,4,5,6};
//        myArray1 myArray = new myArray1();
        System.out.println(findMax(array));

    }
}
